package dhee;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class Block extends JButton implements ActionListener {

	/**
	 * 翻开时的图标
	 */
	private ImageIcon openedIcon;

	/**
	 * 构造器
	 */
	public Block() {
		addActionListener(this);
	}

	/**
	 * 事件监听
	 */
	public void actionPerformed(ActionEvent e) {
		setIcon(getOpenedIcon());
	}

	/**
	 * 设置图标
	 */
	public void setIcon(ImageIcon[] icon) {
		setIcon(icon);
	}

	/**
	 * 取得翻开时的图标
	 */
	public ImageIcon getOpenedIcon() {
		return openedIcon;
	}

	/**
	 * 设置翻开时的图标
	 */
	public void setOpenedIcon(ImageIcon openedIcon) {
		this.openedIcon = openedIcon;
	}

}
